package cn.yhbk.web.modules.manager.Service.Impl;

import cn.yhbk.web.modules.manager.Pojo.Entity.Flag;
import cn.yhbk.web.modules.manager.Mapper.FlagMapper;
import cn.yhbk.web.modules.manager.Service.IFlagService;
import cn.yhbk.web.modules.ums.model.UmsRole;
import cn.yhbk.web.modules.ums.service.UmsRoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 标记表(千万不能删除) 服务实现类
 * </p>
 *
 * @author 有何不可
 * @since 2023-08-10
 */
@Service
@Slf4j
public class FlagServiceImpl extends ServiceImpl<FlagMapper, Flag> implements IFlagService {

    @Autowired
    private UmsRoleService roleService;

    @Override
    public Long getCounsellorRoleId() {
        Flag flag = getById(1L);
        String counsellorRoleName = flag.getFlagValue();
        UmsRole role = roleService.getRoleByRoleName(counsellorRoleName);
        return role.getId();
    }

    @Override
    public Long getStudentRoleId() {
        Flag flag = getById(2L);
        String studentRoleName = flag.getFlagValue();
        UmsRole role = roleService.getRoleByRoleName(studentRoleName);
        return role.getId();
    }

    @Override
    public Long getStuWorkOfficeRoleId() {
        Flag flag = getById(3L);
        String studentRoleName = flag.getFlagValue();
        UmsRole role = roleService.getRoleByRoleName(studentRoleName);
        return role.getId();
    }
}
